﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ShoppingCart.ascx.cs" Inherits="Usercontrol_ShoppingCart" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register src="uscMsgBox.ascx" tagname="uscMsgBox" tagprefix="uc1" %>
<%@ Register src="ShoppingCartDetail.ascx" tagname="ShoppingCartDetail" tagprefix="uc2" %>

<link rel="stylesheet" href='<%=Globals.ApplicationPath %>Css/styleForm.css' type="text/css" /> 
<link href='<%=Globals.ApplicationPath %>Css/ui-lightness/jquery-ui-1.7.2.custom.css' rel="stylesheet" type="text/css" />
<script src="<%=Globals.ApplicationPath %>Scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript" language="javascript"> </script>

<script type="text/javascript">
     $(document).ready(function () {
         //setup new person dialog
         $('#FindOrderTemp').dialog({
             autoOpen: false,
             draggable: true,
             title: "Tìm kiếm giỏ hàng lưu tạm",
             resizable: false,
             //height: auto,
             width: 550,
             modal: true,
             open: function (type, data) {
                 $(this).parent().appendTo("form");
             }
         });
        
     });

     function showDialog(id) {
         $('#' + id).dialog("open");
     }

     function closeDialog(id) {
         $('#' + id).dialog("close");
     }
              
</script>
<asp:UpdatePanel ID="UpdatePanelShoppingCart" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <uc1:uscMsgBox ID="uscMsgBox1" runat="server" Title="Thông báo" CloseText="Đóng lại" CancelText="Bỏ qua" OKText="Đồng ý" />        
        <table width="185" border="0" cellpadding="0" cellspacing="0" class="photo-frame"
            align="center">
            <tr>
                <td class="topx--">
                </td>
                <td class="top-x-">
                </td>
                <td class="top--x">
                </td>
            </tr>
            <tr>
                <td class="midx--">
                </td>
                <td bgcolor="white" style="padding-left: 6px; padding-right: 6px" align="center">
                    <table width="100%" border="0" height="100%" cellpadding="0" cellspacing="0">
                        <tr>
                            <td bgcolor="#f0f0f0" height="178px" valign="top">
                                <table cellspacing="0" cellpadding="0" width="98%" align="center">
                                    <tbody>
                                        <tr>
                                            <td style="padding-left: 3px; padding-top:3px;" align="left">
                                                <table width="100%">
                                                    <tr>
                                                        <td style="font-weight:bold; color:#606060" align="left">
                                                            <a href="<%=Globals.ApplicationPath %>Page/Products/ShoppingCart.aspx?Action=DetailCart">
                                                                <img height="17" src="<%=Globals.ImagesUrl()%>m08.gif" width="14" align="absmiddle" border="0">
                                                            </a>                                                    
                                                            <a href="<%=Globals.ApplicationPath %>Page/Products/shoppingcart.aspx?Action=DetailCart"><%=ResourceManager.GetString("Product_ShoppingCart")%></a></td>
                                                    </tr>
                                                    <tr>
                                                        <td background="<%=Globals.ImagesUrl()%>m09.gif" height="1" style="background-repeat:repeat-x"></td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding-top:5px;">
                                                        <asp:UpdatePanel ID="UpdatePanelpnSoppingCart" runat="server" UpdateMode="Conditional">
                                                            <ContentTemplate>
                                                        <div id="Result">                                                        
                                                            <asp:Panel ID="pnSoppingCart" runat="server" >                                                        
                                                                <asp:GridView runat="server" AutoGenerateColumns="False" 
                                                                    EnableModelValidation="True" ID="gv_ShoppingCart" >                                                        
                                                                    <Columns>
                                                                        <asp:BoundField DataField="ItemKey" HeaderText="ItemKey" Visible="False" />
                                                                        <asp:BoundField DataField="Description" HeaderText="Sản phẩm" />
                                                                        <asp:BoundField DataField="Quantity" HeaderText="Số lượng" />
                                                                    </Columns>
                                                                </asp:GridView>
                                                                <br/>                                                       
                                                        
                                                                <%=ResourceManager.GetString("Product_Subtotal") %>: 
                                                                <span class="ProductPrice">                                                    
                                                                <asp:Label ID="lblTotal" runat="server" Text=""></asp:Label> &nbsp VNĐ
                                                                </span>
                                                            </asp:Panel> 
                                                        </div> 
                                                        </ContentTemplate>
                                                        </asp:UpdatePanel>                                                 
                                                        </td>
                                                    </tr>                                            
                                                    
                                                     <tr>
                                                       <td align="center">                                                           
                                                           <asp:Button ID="btnSearchOrderTemp" runat="server" OnClientClick="showDialog('FindOrderTemp');"
                                                               Text="Tìm giỏ hàng tạm lưu" Width="145px" />
                                                       </td>
                                                    </tr>
                                                    <tr>
                                                       <td>
                                                    
                                                   
                                                       </td>
                                                    </tr>
                                                     <tr>
                                                        <td background="<%=Globals.ImagesUrl()%>m09.gif" height="1" style="background-repeat:repeat-x">
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
                <td class="mid--x">
                </td>
            </tr>
            <tr>
                <td class="botx--">
                </td>
                <td class="bot-x-">
                </td>
                <td class="bot--x">
                </td>
            </tr>
        </table>
    </ContentTemplate>
</asp:UpdatePanel>

<div id='FindOrderTemp'>
    <asp:UpdatePanel ID="upNewUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <div class="formpopup" style="width: auto;" >                  
                 <fieldset style="background: #FFFFFF repeat-x center bottom;" >
                <legend style="font-size: 1.2em;font-weight: bold; margin: 0px 0px 10px 0px;">Thông tin tìm kiếm</legend>
                    <div>                        
                        <label for="normal" style="width:auto" >Số điện thoại hoặc CMND</label>
                        <asp:TextBox ID="txtPhoneOrIDNo" runat="server"></asp:TextBox>
                    </div> 
                    <br />     
                    <div style="text-align:center;">              
                        <asp:Button ID="btnContinue" runat="server" Text="Tìm kiếm" 
                            onclick="btnContinue_Click" />
                    </div>
                </fieldset> 

                 <fieldset style="background: #FFFFFF repeat-x center bottom;" >
                <legend style="font-size: 1.2em;font-weight: bold; margin: 0px 0px 10px 0px;">Thông tin giỏ hàng đã tạm lưu</legend>
                    <div>
                        <table border="0" width="450px" cellpadding="0"  cellspacing="0" align="center">
                            <tr>
                                <td>
                                    <asp:Label ID="lbResulFindShoppingCart" runat="server" Text="" Font-Bold="True" ForeColor="Blue" Visible="False"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding-top:5pt;" align="center">
                                    <asp:GridView runat="server" Width="500px" HorizontalAlign="Center" 
                                        ID="GridViewItem" 
                                        AutoGenerateColumns="False" 
                                        AllowPaging="True" 
                                        AllowSorting="False" 
                                        PagerSettings-Mode="NumericFirstLast"
                                        GridLines="None" 
                                        EnableModelValidation="True" PageSize="20">
                                        <Columns>                                    
                                            <asp:TemplateField HeaderText="Image" 
                                                HeaderStyle-Width="60" ItemStyle-Width="60"
                                                HeaderStyle-HorizontalAlign="Center"
                                                ItemStyle-HorizontalAlign="Center">
                                                <HeaderTemplate><%=ResourceManager.GetString("Image") %></HeaderTemplate>
                                                <ItemTemplate>
                                                    <table>
                                                        <tr>
                                                            <td align="center" width="41px" height="41px" style="border:solid 1px #cccccc; cursor:pointer">
                                                                 <img border="0" src='<%=Globals.ApplicationPath %>Page/Products/Image.ashx?Size=S&ImageUrl=<%# webapp4U.BOL.Products.GetImageUrlByID((string)Eval("ItemKey"))%>' />   
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Width="60px" />
                                                <ItemStyle HorizontalAlign="Center" Width="60px" />
                                            </asp:TemplateField>
                    
                                            <asp:TemplateField HeaderText="Sản phẩm" 
                                                HeaderStyle-Width="200" ItemStyle-Width="200" ItemStyle-Height="40"
                                                HeaderStyle-HorizontalAlign="Left"
                                                ItemStyle-HorizontalAlign ="left">
                                                <HeaderTemplate><%=ResourceManager.GetString("Product_TenSanPham")%></HeaderTemplate>
                                                <ItemTemplate>
                                                    <%# Eval("Description") %>
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                            </asp:TemplateField>
                    
                                            <asp:TemplateField HeaderText="Giá bán(VNĐ)" 
                                                HeaderStyle-Width="100" ItemStyle-Width="100"
                                                HeaderStyle-HorizontalAlign="Left"
                                                ItemStyle-HorizontalAlign ="left">
                                                <HeaderTemplate><%=ResourceManager.GetString("Product_Price")%></HeaderTemplate>
                                                <ItemTemplate>
                                                      <span style="font-weight:normal"><%# (float)Eval("UnitPrice")%> VNĐ</span>
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Left" Width="100px" />
                                                <ItemStyle HorizontalAlign="Left" Width="100px" />
                                            </asp:TemplateField>
                    
                                            <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" HeaderStyle-Width="100px"
                                                HeaderText="Delete">
                                                <HeaderTemplate><%=ResourceManager.GetString("Product_Quantity")%></HeaderTemplate>
                                                <ItemTemplate>
                                                    <span style="font-weight:normal"><%# Eval("Quantity") %></span> 
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                <ItemStyle HorizontalAlign="Center" Width="100px" />
                                            </asp:TemplateField>
                    
                                            <asp:TemplateField HeaderText="Thành Tiền(VNĐ)" 
                                                HeaderStyle-Width="100" ItemStyle-Width="100"
                                                HeaderStyle-HorizontalAlign="Left"
                                                ItemStyle-HorizontalAlign ="left">
                                                <HeaderTemplate><%=ResourceManager.GetString("Product_UnitSubTotal")%></HeaderTemplate>
                                                <ItemTemplate>
                                                      <span style="font-weight:normal"><%# (Double)Eval("Subtotal")%> VNĐ</span>
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Left" Width="100px" />
                                                <ItemStyle HorizontalAlign="Left" Width="100px" />
                                            </asp:TemplateField>
                     
                                        </Columns>
                                        <EmptyDataTemplate>
                                            <table align="center" width="100%" border="0" bgcolor="#ffffcc" bordercolorlight="#0099cc"  bordercolor="#0099cc">
                                                <tr>
                                                    <td height="50" align="center">
                                                        <div align="center" id="EmptyData"><%=ResourceManager.GetString("Product_ShoppingCartEmpty")%></div>
                                                    </td>   
                                                </tr>
                                            </table>
                                        </EmptyDataTemplate>
                                        <PagerSettings Mode="NumericFirstLast" />
                                    </asp:GridView>   
                                </td>
                            </tr>

                            <tr>
                                <td align="right"> 
                                    <asp:Panel runat="server" ID="PanelUpdate">
                                        <table cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td align="right" class="ProductPrice" style="padding-top:8px;">
                                                    <asp:Label ID="lbTotalOrder" runat="server"
                                                        Text=""></asp:Label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="padding-top:8px;">
                                                    <asp:Button ID="btnAddShoppingCart" runat="server" 
                                                        Text="Thêm vào giỏ hàng và đóng lại" onclick="btnAddShoppingCart_Click" />
                                                      &nbsp  <asp:Button ID="btnClose" runat="server" Text="Đóng lại" 
                                                        onclick="btnClose_Click" />                                                    
                                                </td> 
                                            </tr> 
                                        </table>
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>       
                    </div>
                </fieldset>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>   
 </div>

 